<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <h:head>

        <meta http-equiv="Window-target" content="_top" />
        <meta http-equiv="imagetoolbar" content="no" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

        <h:outputStylesheet library="css" name="style.css" />
        <h:outputStylesheet library="css" name="jquery-ui-1.8.16.custom.css" />
        <h:outputStylesheet library="css" name="lightbox.css" />
        <h:outputScript library="script" name="prototype.js"/>
        <h:outputScript library="script" name="jquery-1.6.2.min.js"/>
        <h:outputScript library="script" name="jquery-ui-1.8.16.custom.min.js"/>
        <h:outputScript library="script" name="jquery.js"/>
        <h:outputScript library="script" name="ourFunctions.js"/>

        <link rel="icon" href="#{pathBean.path}resources/img/favicon.ico" type="image/x-icon" />
        <link rel="shortcut icon" href="#{pathBean.path}resources/img/favicon.ico" type="image/x-icon" />

        <title>
            <ui:insert name="title"></ui:insert>
        </title>
    </h:head>
    <h:body>
        <div id="container">
            <div id="container_margin">
                <div id="top">
                    <div id="logo">
                        <h:link>
                            <h:graphicImage library="img" name="logo.png" width="250" height="155" alt="Sunshine Hotel"/>
                        </h:link>
                    </div>

                    <div id="top_right">
                        <h:form>
                            <c:if test="${sessionScope['loginUser'] != null}"> 

                                <p>
                                    <h:outputText value="Welcome #{sessionScope['loginUser'].name}!" />
                                </p>
                            </c:if>
                            <p>

                                <br />

                                <c:if test="${sessionScope['loginUser'] == null}">
                                    <h:commandButton value="Login" action="login.xhtml"/>
                                    <br />
                                    <br />
                                    <h:commandButton value="Register" action="register.xhtml"/>
                                </c:if>
                                <c:if test="${sessionScope['loginUser'] != null}">
                                    <h:commandButton value="Logout" action="#{loginBean.logout}"/>
                                </c:if>
                            </p>
                        </h:form>
                    </div>
                </div>

                <div id="main_tabs">
                    <ul class="tabs">
                        <!-- Make JSF links of these. -->
                        <li><a href="#" onclick="window.location='#{pathBean.path}welcome.jsf'">Home</a></li>
                        <li><a href="loader.jsf" onclick="window.location='#{pathBean.path}book.jsf'">Book room</a></li>
                        <li><a href="loader.jsf" onclick="window.location='#{pathBean.path}about.jsf'">About</a></li>
                        <li><a href="loader.jsf" onclick="window.location='#{pathBean.path}photos.jsf'">Photos</a></li>
                        <li><a href="loader.jsf" onclick="window.location='#{pathBean.path}contact.jsf'">Contact</a></li>
                        <li><a href="loader.jsf" onclick="window.location='#{pathBean.path}help.jsf'">Help</a></li>

                        <!-- Show only if a user is logged in! -->
                        <c:if test="${sessionScope['loginUser'] != null}"> 
                            <li><a href="loader.jsf" onclick="window.location='#{pathBean.path}user/mypage.jsf'">My Page</a></li>

                            <!-- Show only if a Admin is logged in! -->
                            <c:if test="${sessionScope['loginUser'].auth == 1}">
                                <li><a href="loader.jsf" onclick="window.location='#{pathBean.path}admin/viewRooms.jsf'">All Rooms</a></li>
                                <li><a href="loader.jsf" onclick="window.location='#{pathBean.path}admin/addRoom.jsf'">Add Room</a></li>
                                <li><a href="loader.jsf" onclick="window.location='#{pathBean.path}admin/edituser.jsf'">Edit Users</a></li>
                                <li><a href="loader.jsf" onclick="window.location='#{pathBean.path}admin/booking_edit.jsf'">Edit Booking</a></li>
                            </c:if>
                        </c:if>
                    </ul>
                    <div id="main_tabs-1">
                        <div class="clearing" style="margin: 20px;">


                            <!--CONTENT WE WILL INSERT-->
                            <ui:insert name="content">Default content</ui:insert>

                        </div>
                    </div>
                </div>
            </div>
        </div> 
    </h:body>
</html>